# Maintainer: Levente Polyak <anthraxx@archlinux.org>
# Contributor: Gaetan Bisson <bisson@archlinux.org>
# Contributor: Pierre Schmitz <pierre@archlinux.de>
# Contributor: Bug <Bug2000@gmail.com>

pkgname=libotr
pkgver=4.1.1
pkgrel=4
pkgdesc='Off-the-Record Messaging Library and Toolkit'
url='https://otr.cypherpunks.ca/'
license=('GPL' 'LGPL')
arch=('loong64' 'x86_64')
depends=('libgcrypt')
validpgpkeys=('22DF3305DF56667CE15784FCF24DE08F42C2ABAD') # OTR Dev Team
source=(https://otr.cypherpunks.ca/${pkgname}-${pkgver}.tar.gz{,.asc}
        "$pkgname-4.1.1-include-socket.h.patch"
        libotr-fix-build.patch)
sha256sums=('8b3b182424251067a952fb4e6c7b95a21e644fbb27fbd5f8af2b2ed87ca419f5'
            'SKIP'
            'cfda75f8c5bba2e735d2b4f1bb90f60b45fa1d554a97fff75cac467f7873ebde'
            '8564fd454e46d7d90919c9b665ea6634868d64f96cfa5e25163d772f9c88d2f4')

prepare() {
    # FS#75450
    patch -d "$pkgname-$pkgver" -N -p 1 -i "${srcdir}/$pkgname-4.1.1-include-socket.h.patch"
    patch -d "$pkgname-$pkgver" -N -p 1 -i "$srcdir/libotr-fix-build.patch"
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  ./configure --prefix=/usr --mandir=/usr/share/man
  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install
}
